<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        body{
            margin: 0px;
        }
        #div{
            width: 400px;
            height: 2000px;
            background: orange;
        }
        .d{
            /*margin: 5px;*/
        }
        #d1{
            width: 100px;
            height: 100px;
            background: #008B8B;
            float: right;
        }
        #d2{
            width:100px;
            height: 100px;
            background: gray;
            /*clear: both;*/
            float: right;
        }
        #d3{
            width: 100px;
            height: 100px;
            background: red;
            float: right;
        }
        #d4{
            width: 100px;
            height: 100px;
            background: rebeccapurple;
            float: left;
        }
        #s1{
            width: 100px;
            height: 100px;
            background: red;
            color: orange;
        }
        #s2{
            width: 100px;
            height: 100px;
            background: rebeccapurple;
        }
    </style>
</head>
<body>
<div id="div">
    <div class="d" id="d1">div1</div>
    <div class="d" id="d2">div2</div>
    <div class="d" id="d3">div3</div>
    <div class="d" id="d4">div4</div>
</div>

<!--<span id="s1">span1</span>-->
<!--<span id="s2">span2</span>-->
</body>
</html>